﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using OperationPlugins.WebApp.Views;

namespace OperationPlugins.WebApp.Filters
{
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
    public class ActiveLayoutMenuAttribute : FilterAttribute, IAuthorizationFilter
    {
        public bool CurrentActionUnderApplications { get; set; }
        public bool CurrentActionUnderEventLogs { get; set; }
        public bool CurrentActionUnderPreferences { get; set; }

        public void OnAuthorization(AuthorizationContext filterContext)
        {
            var rl = Layout.Current;

            rl.CurrentActionUnderApplications = CurrentActionUnderApplications;
            rl.CurrentActionUnderEventLogs = CurrentActionUnderEventLogs;
            rl.CurrentActionUnderPreferences = CurrentActionUnderPreferences;
        }
    }
}